from day_0927.Base import Base
from selenium import webdriver
import time,pytest,openpyxl
@pytest.fixture()
def driver():
    driver=webdriver.Edge()
    driver.maximize_window()
    yield driver
    driver.close()
def test_log(driver):
    work=openpyxl.load_workbook('gjz.xlsx')
    excel=work['Sheet1']
    base=Base(driver)
    for rew in excel.iter_rows(min_row=2,values_only=True):
        action=rew[2]
        params={}
        if action=='goto':
            params['url']=rew[5]
        elif action in('click','text','send_keys'):
            params['loc']=[rew[3],rew[4]]
            if action=='send_keys':
                params['text']=rew[5]
        if action=='sleep':
            params['timeout']=rew[5]
        mthod=getattr(base,str(action))
        mthod(**params)